//
//  App_ConfirmHandler.swift
//  mall-ios
//
//  Created by Meak Tsui on 2019/1/7.
//  Copyright © 2019 Meak Tsui. All rights reserved.
//

import Foundation
import MTHybrid

extension Api {
    static let Confirm = Api("confirm")
}

class App_ConfirmHandler: MTEventHandler {
    var ns: Ns {
        return .App
    }
    
    var action: Api {
        return .Confirm
    }
    
    func handler(_ msg: MTHybridMsg) {
        let title = msg.params["title"] as? String
        let message = msg.params["msg"] as? String
        let yesTitle = msg.params["yesTitle"] as? String
        let noTitle = msg.params["noTitle"] as? String
        
        msg.vc.confirm(title: title, message: message,yesTitle: yesTitle,noTitle: noTitle) { result in
            msg.callbackClosure?(result)
        }
    }
    
    
}
